import http from "@/utils/http";
import type { AreaTreeParams, IplanParams } from "@/api/common/types";

// 获取区域树
export const getAreaTreeApi = (data: AreaTreeParams) =>
    http.post("/currency/areaTree", data);

// 获取管理单元树
export const getAdminUnitApi = (data: AreaTreeParams) =>
    http.post("/currency/manageUnitTree", data);

// 获取监测井树
export const getMonitorTreeApi = (data: AreaTreeParams) =>
    http.post("/currency/wellTree", data);

// 获取计划列表
export const getPlan = (data: IplanParams) =>
    http.post("/underWater/runoff/task/list", data);

// 获取TFI
export const getTFI = (data: any): Promise<Blob> => {
    return new Promise((resolve, reject) => {
        fetch("http://111.56.142.55:10019/underWater/basinPredictMsTif", {
            method: "POST",
            headers: {
                "Content-Type": "application/json",
            },
            body: JSON.stringify(data),
        }).then((res) => {
            resolve(res.blob());
        });
    });
};
